{include file='../application/admin/view/link.html'/}
<style>
    #modal-alert{top:23%}
    .modal-alert-info{height: 60px;display: block;text-align:center;line-height:50px;}
</style>
<title>后台登录 - H-ui.admin.page v3.0</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
	<div id="loginform" class="loginBox">
		<form class="form form-horizontal" action="{:url('login/checkLogin')}" method="post" onsubmit="return checkCaptcha()">
			<div class="row cl">
				<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
				<div class="formControls col-xs-8">
					<input id="username" name="username" type="text" placeholder="账户" class="input-text size-L" required='true'>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
				<div class="formControls col-xs-8">
					<input id="password" name="password" type="password" placeholder="密码" class="input-text size-L" required=true>
				</div>                                
			</div>
                        {eq name="$is_captcha" value='1'}
                            <div class="row cl">
                                <div class="formControls col-xs-8 col-xs-offset-3">
                                    <input name="captcha" id="captcha" class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;" required=true>
                                    <img src="{:url('login/show_captcha')}" alt="" width="121" height="40" class="passcode" onclick="this.src=this.src+'?'"/>
                                </div>
                            </div>
                        {/eq}
<!--			<div class="row cl">
				<div class="formControls col-xs-8 col-xs-offset-3">
					<label for="online">
                                            <input type="checkbox" name="online" id="online" value="">
                                            使我保持登录状态</label>
				</div>
			</div>-->
			<div class="row cl">
				<div class="formControls col-xs-8 col-xs-offset-3">
					<input name="" type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">　　
					<input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;重&nbsp;&nbsp;&nbsp;&nbsp;置&nbsp;">
				</div>
			</div>
		</form>
	</div>
</div>
<div class="footer">Copyright 你的公司名称 by H-ui.admin.page.v3.0</div>
{include file='../application/admin/view/foot.html'/}
<script>
    function refreshVerify() {
        var ts = Date.parse(new Date())/1000;
        $('#verify_img').attr("src", "/captcha?id="+ts);
    }
</script>
<script>    
    function checkCaptcha(){
        var is_captcha  ="<?=$is_captcha;?>";
        var password    =$("#password").val();
        var username    =$("#username").val();
        var captcha     ='';
        var passwd      ='';
        if(password.trim().length!=32){
            passwd  =$.md5(password);
            $("#password").val(passwd);
        }else{
            passwd=password;
        }
        if(is_captcha==1){
            //有验证码
            captcha=$("#captcha").val();
            if(captcha.trim().length==0 || captcha=='验证码:'){
                $.Huimodalalert('请填写验证码',1000);
                return false;
            }            
        } 
        var res=null;
        var msg=null;        
        $.ajax({
                url : 'ajaxCheck',
                data:{captcha:captcha,username:username,password:passwd,is_ajax:1},
                async : false,
                type : "post",
                dataType : 'json',
                success : function (data){
                res=data.errcode;
                msg=data.msg;
            }                
        });
        if(res!=null && res!=0){
            if(res==10001){
                $('.passcode').trigger("click");
            }
            $.Huimodalalert(msg,1000);
            return false;
        }
    }
</script>